import Vue from 'vue'
import Router from 'vue-router'
import index from '../components/index.vue'
import my from '../components/my/my.vue'
import searchpage from '../components/menu/searchpage.vue'
import music from '../components/music/music.vue'
import songpage from '../components/music/songpage'
import video from '../components/video/video.vue'
import lists from '../components/music/lists.vue'
import allvideo from '../components/video/allvideo.vue'

Vue.use(Router)

const routes =[
	 {path:'/',name:'/',component:index},
	 {path:'/',redirect:'/index'},  //  指向默认路由
	 {path:'/my',name:'my',component:my},
	 {path:'/searchpage',name:'searchpage',component:searchpage},
	 {path:'/music',name:'music',component:music},
	 {path:'/songpage',name:'songpage',component:songpage},
	 {path:'/video',name:'video',component:video},
	 {path:'/lists',name:'lists',component:lists},
	 {path:'/allvideo',name:'allvideo',component:allvideo},
	 
]

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
};

export default new Router({
	routes,
    mode: 'history'  //  哈希会让地址栏有#，加这句去掉地址栏的#
})